<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>xiaxuchen的博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="Vue学习中常用知识1. 左右布局一般的左右布局(左边固定，右边占满剩余)**都是依赖于脱离文档流和div宽度会占满父元素**两个特性来实现的，只要左边的元素脱离文档流，则他就会浮在右边元素上，只要让右边元素的内容区刚好与左边元素相贴即可 如浮动实现，浮动使得左边的元素脱离文档流，然后给右边的div添加一个左边距，如此即可 1234567891011@leftWidth: 200px;  .con">
<meta property="og:type" content="article">
<meta property="og:title" content="xiaxuchen的博客">
<meta property="og:url" content="http://yoursite.com/2020/08/07/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0%202025/index.html">
<meta property="og:site_name" content="xiaxuchen的博客">
<meta property="og:description" content="Vue学习中常用知识1. 左右布局一般的左右布局(左边固定，右边占满剩余)**都是依赖于脱离文档流和div宽度会占满父元素**两个特性来实现的，只要左边的元素脱离文档流，则他就会浮在右边元素上，只要让右边元素的内容区刚好与左边元素相贴即可 如浮动实现，浮动使得左边的元素脱离文档流，然后给右边的div添加一个左边距，如此即可 1234567891011@leftWidth: 200px;  .con">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="c:/Users/xxc、/AppData/Roaming/Typora/typora-user-images/image-20200205230500224.png">
<meta property="og:image" content="c:/Users/xxc、/AppData/Roaming/Typora/typora-user-images/image-20200211131622880.png">
<meta property="article:published_time" content="2020-08-07T15:08:02.130Z">
<meta property="article:modified_time" content="2020-07-19T10:36:54.180Z">
<meta property="article:author" content="xiaxuchen">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="c:/Users/xxc、/AppData/Roaming/Typora/typora-user-images/image-20200205230500224.png">
  
    <link rel="alternate" href="./atom.xml" title="xiaxuchen的博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  
<link rel="stylesheet" href="./css/style.css">

<meta name="generator" content="Hexo 5.0.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="./" id="logo">xiaxuchen的博客</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="./">Home</a>
        
          <a class="main-nav-link" href="./archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="./atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-开发笔记/开发笔记 2025" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="./2020/08/07/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0%202025/" class="article-date">
  <time datetime="2020-08-07T15:08:02.130Z" itemprop="datePublished">2020-08-07</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="Vue学习中常用知识"><a href="#Vue学习中常用知识" class="headerlink" title="Vue学习中常用知识"></a>Vue学习中常用知识</h4><h4 id="1-左右布局"><a href="#1-左右布局" class="headerlink" title="1. 左右布局"></a>1. 左右布局</h4><p>一般的<strong>左右布局(左边固定，右边占满剩余)**都是依赖于</strong>脱离文档流<strong>和</strong>div宽度会占满父元素**两个特性来实现的，只要左边的元素脱离文档流，则他就会浮在右边元素上，只要让右边元素的内容区刚好与左边元素相贴即可</p>
<p>如浮动实现，浮动使得左边的元素脱离文档流，然后给右边的div添加一个左边距，如此即可</p>
<figure class="highlight less"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">@leftWidth:</span> <span class="number">200px</span>;</span><br><span class="line">  <span class="selector-class">.content</span> &#123;</span><br><span class="line">    <span class="selector-tag">&amp;</span>&gt;<span class="selector-class">.left</span> &#123;</span><br><span class="line">      <span class="attribute">float</span>: left;</span><br><span class="line">      <span class="attribute">width</span>: <span class="variable">@leftWidth</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="selector-tag">&amp;</span>&gt;<span class="selector-class">.right</span> &#123;</span><br><span class="line">      <span class="attribute">margin-left</span>: <span class="variable">@leftWidth</span>;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>

<p>而绝对定位的实现呢，只是将浮动改为绝对定位即可</p>
<h4 id="2-不熟悉的标签不要乱用"><a href="#2-不熟悉的标签不要乱用" class="headerlink" title="2.不熟悉的标签不要乱用"></a>2.不熟悉的标签不要乱用</h4><p>在开发中，使用el-row、el-col作为vue组件的根元素，出现了如页面被el-row撑开，el-pagination永远在上一行等等奇怪的问题</p>
<h4 id="3-div就是铺满父元素的"><a href="#3-div就是铺满父元素的" class="headerlink" title="3. div就是铺满父元素的"></a>3. div就是铺满父元素的</h4><p>一直以来想着用<code>width:100%</code>来铺满父元素，但是这样会出现巨大的问题，会让子元素超出父元素的内容区，如<strong>第1点</strong>实现的左右布局若使用padding-left代替margin-left，则子元素与父元素的关系如图所示:</p>
<p><img src="C:\Users\xxc、\AppData\Roaming\Typora\typora-user-images\image-20200205230500224.png" alt="image-20200205230500224"></p>
<h4 id="4-SessionStroage是窗口内有效"><a href="#4-SessionStroage是窗口内有效" class="headerlink" title="4. SessionStroage是窗口内有效"></a>4. SessionStroage是窗口内有效</h4><h4 id="5-Promise的finally、done方法无效"><a href="#5-Promise的finally、done方法无效" class="headerlink" title="5. Promise的finally、done方法无效"></a>5. Promise的finally、done方法无效</h4><p>原生的Promise是没有这两个方法的，可以使用npm install axios promise.prototype.finally –save   然后require(‘promise.prototype.finally’).shim()<br>参考<a target="_blank" rel="noopener" href="https://github.com/axios/axios/issues/457">https://github.com/axios/axio…</a></p>
<h4 id="6-provide、inject"><a href="#6-provide、inject" class="headerlink" title="6. provide、inject"></a>6. provide、inject</h4><p>使用provide和inject机制可以使得父组件的数据传递到后代组件中，而无需一级一级传递，但是，他们管理的数据不是响应式的，我们可以使用vuex做到同样的功能，而且数据是响应式的</p>
<h4 id="7-webstorm对路径别名无提示，如"><a href="#7-webstorm对路径别名无提示，如" class="headerlink" title="7. webstorm对路径别名无提示，如@"></a>7. webstorm对路径别名无提示，如@</h4><p>在项目的根目录创建一个alias.config.js文件，如下所述</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;**</span><br><span class="line"> * 由于 Vue CLI 3 不再使用传统的 webpack 配置文件，故 WebStorm 无法识别别名</span><br><span class="line"> * 本文件对项目无任何作用，仅作为 WebStorm 识别别名用</span><br><span class="line"> * 进入 WebStorm preferences -&gt; Language &amp; Framework -&gt; JavaScript -&gt; Webpack，选择这个文件即可</span><br><span class="line"> * *&#x2F;</span><br><span class="line">const resolve &#x3D; dir &#x3D;&gt; require(&#39;path&#39;).join(__dirname, dir);</span><br><span class="line"></span><br><span class="line">module.exports &#x3D; &#123;</span><br><span class="line">  resolve: &#123;</span><br><span class="line">    alias: &#123;</span><br><span class="line">      &#39;@&#39;: resolve(&#39;src&#39;)</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>

<h4 id="8-jest出现问题-Test-suite-failed-to-run-SecurityError-localStorage-is-not-available-for-opaque-origins"><a href="#8-jest出现问题-Test-suite-failed-to-run-SecurityError-localStorage-is-not-available-for-opaque-origins" class="headerlink" title="8. jest出现问题:  Test suite failed to run SecurityError: localStorage is not available for opaque origins"></a>8. jest出现问题:  Test suite failed to run SecurityError: localStorage is not available for opaque origins</h4><p>配置一下两项</p>
<p><img src="C:\Users\xxc、\AppData\Roaming\Typora\typora-user-images\image-20200211131622880.png" alt="image-20200211131622880"></p>
<p>在jest.config.js中添加配置项：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">verbose: true,</span><br><span class="line">testURL: &#39;http:&#x2F;&#x2F;localhost&#x2F;&#39;</span><br></pre></td></tr></table></figure>

<h4 id="9-git-clone-出现问题：fatal-protocol-‘https’-is-not-supported"><a href="#9-git-clone-出现问题：fatal-protocol-‘https’-is-not-supported" class="headerlink" title="9.git clone 出现问题：fatal: protocol ‘https’ is not supported"></a>9.git clone 出现问题：fatal: protocol ‘https’ is not supported</h4><p>git bash中shift + ins才是粘贴，我们ctrl + v输入了一个隐藏字符</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/baidu_41704597/article/details/99718232">原文参考</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2020/08/07/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0%202025/" data-id="ckdkdagvo000rvout2i72axny" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="./2020/08/07/%E8%80%83%E7%A0%94/Maven%E6%89%93%E5%8C%85%E9%83%A8%E7%BD%B2SpringBoot%E9%A1%B9%E7%9B%AE/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          (no title)
        
      </div>
    </a>
  
  
    <a href="./2020/08/07/%E5%90%8E%E7%AB%AF/%E9%98%BF%E9%87%8C%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%BC%80%E5%90%AFredis%E7%AB%AF%E5%8F%A3/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title"></div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="./archives/2020/08/">August 2020</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="./2020/08/07/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B9%8B%E9%93%BE%E8%A1%A8/">(no title)</a>
          </li>
        
          <li>
            <a href="./2020/08/07/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B9%8B%E6%A0%88%E4%B8%8E%E9%98%9F%E5%88%97/">(no title)</a>
          </li>
        
          <li>
            <a href="./2020/08/07/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B9%8B%E6%95%B0%E7%BB%84/">(no title)</a>
          </li>
        
          <li>
            <a href="./2020/08/07/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/%E6%80%9D%E7%BB%B4%E5%AF%BC%E5%9B%BE/">(no title)</a>
          </li>
        
          <li>
            <a href="./2020/08/07/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/SpringBoot%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/">(no title)</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2020 xiaxuchen<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="./" class="mobile-nav-link">Home</a>
  
    <a href="./archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  
<link rel="stylesheet" href="./fancybox/jquery.fancybox.css">

  
<script src="./fancybox/jquery.fancybox.pack.js"></script>




<script src="./js/script.js"></script>




  </div>
</body>
</html>